﻿using DomainModel.Domain.Model.MessageAssemblyModel;
using DomainModel.Domain.Model.ServiceModel;
using NUnit.Framework;

namespace DomainModel.Tests.Domain.Model.ServiceModel
{
    [TestFixture]
    public class when_adding_the_same_message_assembly_to_a_service
    {
        Service _sut;

        [SetUp]
        public void Before()
        {
            _sut = new Service(new ServiceId(1));
        }

        [Test]
        public void should_not_create_duplicate_in_the_message_assemblies_list()
        {

            _sut.AddMessageAssembly(new MessageAssembly(new MessageAssemblyId(1)));

            Assert.NotNull(_sut.MessageAssembliesSet, "MessageAssembliesSet should not be null");
            Assert.IsTrue(_sut.MessageAssembliesSet.Count == 1, "MessageAssembliesSet should contain one element");

            _sut.AddMessageAssembly(new MessageAssembly(new MessageAssemblyId(1)));

            Assert.IsTrue(_sut.MessageAssembliesSet.Count == 1, "MessageAssembliesSet should still contain one element");
        }

    }
}
